Skip to content

test(e2e): extend Germany onboarding flow through Pre-Onboarding Requirements - #1370

Merged
gabrielseco merged 13 commits into
mainfrom
e2e-germany-preonboarding-requirements
Sep 23, 2026
Merged

gabrielseco merged 13 commits into
mainfrom
e2e-germany-preonboarding-requirements

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Extends the Germany onboarding e2e test (stacked on #1361) to cover the Pre-Onboarding Requirements step: acknowledging the required policy, then reviewing and signing the Individual Labor Agreement (ILA).

Why

#1361 fills the Benefits step but the test still stopped at the Review step title with the Pre-Onboarding Requirements section untested. That step gates the invite: the employee can't be invited until every requirement (e.g. the ILA) is signed, and signing freezes the employment data so it can no longer be edited. Neither behavior had e2e coverage.

What changed

Toggle details
  • New helper example/e2e/helpers/preOnboardingRequirements.ts: completePreOnboardingRequirements(page, signature) checks each acknowledgement checkbox and signs each document requirement (e.g. the ILA), looping a few rounds since requirements can depend on each other (the ILA is blocked until the acknowledgement is checked). Disambiguates the two dialogs involved (the full-screen document preview and the signature dialog, both Radix Dialogs that portal independently to document.body) via their data-slot attributes.
  • onboard-germany-employee.spec.ts: after Benefits, asserts the invite button is disabled, completes the pre-onboarding requirements, then asserts every review-step "Edit ..." button is now disabled (employment data frozen) and the invite button is enabled.
  • Fixes a pre-existing gap in the same test: it asserted the Review step followed Benefits directly, but the flow actually surfaces a "Preview Employment Agreement" step first — the test now submits that step.

Screenshots

N/A

Related Resources

Testing

  • Tested against the example/ app in a browser — ran twice against the real sandbox via the local dev server, both passed.
  • Feature flag: N/A

Note

Low Risk
Playwright e2e coverage only; no production application or API behavior changes.

Overview
Extends the Germany employee onboarding Playwright test through the Review step’s Pre-Onboarding Requirements, which gate inviting the employee.

A new helper completePreOnboardingRequirements skips gracefully when the section is absent (with a test annotation), otherwise checks the acknowledgement checkbox, opens the full-screen document dialog, signs with the employee’s full name, and waits for the dialog to close. The spec reuses the generated fullname for the signature, asserts Invite Employee is disabled until requirements are done, runs the helper, then asserts all review Edit controls are disabled and the invite button is enabled with the expected label.

Reviewed by Cursor Bugbot for commit 81851a3. Bugbot is set up for automated code reviews on this repo. Configure here.

gabrielseco and others added 7 commits September 22, 2026 12:11
Replaces the bare "Benefits" title assertion with a real fill: intercepts
the benefit-offers schema response and drives createHeadlessForm (the same
engine the app runs) to discover visible radio/select fields round by
round, so conditionally-revealed fields (e.g. a benefit's "value" after its
"filter" is picked) get filled without hardcoding a country's benefit-group
UUIDs, unlike the existing Spain-only helper. Extends the assertion through
the Review step.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
watchForBenefitsSchema silently fell back to an empty schema on a
non-2xx response, turning a real API failure into a confusing
downstream submit/validation failure instead of a clear error at the
point of interception.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Register the benefit-offers schema listener before Introduction
  submits (creates the employment), not before Contract Details:
  useBenefitOffersSchema is enabled as soon as employmentId exists,
  so the request had already resolved by the time the old listener
  was registered, and waitForResponse hung until timeout.
- Feed createHeadlessForm a real nested initialValues object instead
  of a flat one keyed by the dotted data-field string. The dotted
  string is only valid as a DOM lookup key; the schema's own if/then
  conditionals read a nested object, so a benefit's "value" field
  never appeared once its "filter" was picked.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replaces fillOnboardingStep4SpainForm's hardcoded sandbox-company
benefit-group UUIDs with the same schema-driven helper the Germany
spec now uses, so both onboarding e2e tests fill Benefits generically
instead of one of them being tied to one company's fixed field names.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…eHeadlessForm

createHeadlessForm is called once and handleValidation is used to
re-evaluate conditionals each round: both jsf v0 and v1 mutate the
same `fields` array in place rather than returning a new one, so
recomputing the whole form from scratch every round was redundant.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Documents the pattern discovered while building the dynamic Benefits
e2e helper: call createHeadlessForm once and recompute conditionals
via handleValidation (which mutates the same fields array in place
for both jsf v0 and v1) instead of re-calling createHeadlessForm on
every value change. Notes the existing src/flows/*/api.ts hooks that
do the latter as accepted legacy debt, not the pattern for new code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…irements

Fills the gap after Benefits: acknowledges the Time Tracking Policy
checkbox, reviews and signs the ILA, then verifies the review step's
edit buttons become disabled (employment data frozen) and the invite
button is no longer blocked, now that every requirement is finished.

Also fixes the prior assertion that the Review step followed Benefits
directly — the flow actually surfaces a Preview Employment Agreement
step first, which the test now submits.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-gufwq8b39-remotecom.vercel.app
Latest Commit:81851a3

Deployed with vercel-action

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-hyzh2jjel-remotecom.vercel.app
Latest Commit:81851a3

Deployed with vercel-action

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚪ Coverage unchanged

Metric Current Previous Change Status
Lines 86.34% 86.34% 0% ⚪
Statements 85.91% 85.91% 0% ⚪
Functions 84.92% 84.92% 0% ⚪
Branches 77.77% 77.77% 0% ⚪

Detailed Breakdown

Lines Coverage
  • Covered: 4849 / 5616
  • Coverage: 86.34%
  • Change: 0% (0 lines)
Statements Coverage
  • Covered: 4933 / 5742
  • Coverage: 85.91%
  • Change: 0% (0 statements)
Functions Coverage
  • Covered: 1290 / 1519
  • Coverage: 84.92%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3001 / 3859
  • Coverage: 77.77%
  • Change: 0% (0 branches)

✅ Coverage check passed

gabrielseco and others added 4 commits September 23, 2026 09:24
Replaces the round-based loop with a flat, sequential check-then-sign,
since this sandbox company always returns the same fixed shape (one
acknowledgement, then one document). Revisit if a company with a
different requirement shape needs coverage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI's sandbox company goes straight from Benefits to Review — the
Preview Employment Agreement step isn't universal, it depends on the
company's account configuration, not the country. My local run's
sandbox account happened to have it enabled; CI's doesn't.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI's sandbox company doesn't have this step enabled, so asserting
'Review' directly after Benefits matches today's reality. If the
account config changes and the step gets enabled, this test should
break — that's the signal to update it, not something to paper over
preemptively.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Base automatically changed from e2e-germany-dynamic-benefits to main September 23, 2026 08:23
@gabrielseco
gabrielseco merged commit f44981e into main Sep 23, 2026
12 checks passed
@gabrielseco
gabrielseco deleted the e2e-germany-preonboarding-requirements branch September 23, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants